
//
// 110216 - AH - (Hector) created.
// 110222 - AH - Minor java doc fix.
// 110423 - AH - No more direct access to ontology on SoekratEngine, must
//               use getWheel() first to get.
//

package org.soekrat.swing.network;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dialog;
import java.awt.Frame;

import javax.swing.JDialog;

import org.soekrat.engine.Soekrat2Engine;
import org.soekrat.engine.network.Network;

/**
 * <p>
 *   A simple matrix based (matrix edited directly in a table) 
 *   {@link Network} editor.
 * </p>
 * @author Arne Halvorsen (AH) 
 * @author Laetitia Le Chatton (LLC) 
 */
@SuppressWarnings("serial")
public final class SimpleNetworkEditorDialog extends JDialog 
{ 
  private NetworkTableView m_ntv;
  
  /**
   * <p>
   *   Construction.
   * </p>
   * @param se {@link Soekrat2Engine}.
   */
  public SimpleNetworkEditorDialog(Soekrat2Engine se){ buildGui(se); }
  
  /**
   * <p>
   *   Construction.
   * </p>
   * @param se {@link Soekrat2Engine}.
   * @param p  Parent to dialog.
   */
  public SimpleNetworkEditorDialog(Soekrat2Engine se, Frame p)
  {
    super(p);
    
    buildGui(se);  
  }
  
  /**
   * <p>
   *   Construction.
   * </p>
   * @param se {@link Soekrat2Engine}.
   * @param p  Parent to dialog.
   */
  public SimpleNetworkEditorDialog(Soekrat2Engine se, Dialog p)
  {
    super(p);
    
    buildGui(se);
  }
  
  private void buildGui(Soekrat2Engine se)
  {
    if (se==null)
    {
      throw new NullPointerException("se");
    }
    
    m_ntv=new NetworkTableView();
    m_ntv.setNetwork(se.getWheel().getNetwork());
    
    Container c=getContentPane();
    c.setLayout(new BorderLayout());
    add(m_ntv, BorderLayout.CENTER);
    
    pack();
    setSize(800, 500);
  }
  
}
